fun call f arg = print ((Int16.toString (f arg) handle Overflow => "Overflow" | Div => "Div") ^ "\n")
fun callS f arg = print ((f arg handle Overflow => "Overflow" | Div => "Div") ^ "\n")
fun callO f arg = print (((case f arg of SOME x => "SOME " ^ Int16.toString x | NONE => "NONE") handle Overflow => "Overflow" | Div => "Div") ^ "\n")
fun callP f arg = print (((case f arg of (x, y) => "(" ^ Int16.toString x ^ "," ^ Int16.toString y ^ ")") handle Overflow => "Overflow" | Div => "Div") ^ "\n")
fun bin (x, y) = ( print (Int16.toString x ^ " + " ^ Int16.toString y ^ " = ")
                 ; call Int16.+ (x, y)
                 ; print (Int16.toString x ^ " - " ^ Int16.toString y ^ " = ")
                 ; call Int16.- (x, y)
                 ; print (Int16.toString x ^ " * " ^ Int16.toString y ^ " = ")
                 ; call Int16.* (x, y)
                 ; print (Int16.toString x ^ " div " ^ Int16.toString y ^ " = ")
                 ; call Int16.div (x, y)
                 ; print (Int16.toString x ^ " mod " ^ Int16.toString y ^ " = ")
                 ; call Int16.mod (x, y)
                 ; print (Int16.toString x ^ " quot " ^ Int16.toString y ^ " = ")
                 ; call Int16.quot (x, y)
                 ; print (Int16.toString x ^ " rem " ^ Int16.toString y ^ " = ")
                 ; call Int16.rem (x, y)
                 );
fun un x = ( print ("~ " ^ Int16.toString x ^ " = ")
           ; call Int16.~ x
           ; print ("abs " ^ Int16.toString x ^ " = ")
           ; call Int16.abs x
           (* ; print ("fmt BIN " ^ Int16.toString x ^ " = ")
           ; callS (Int16.fmt StringCvt.BIN) x ... not implemented yet *)
           ; print ("fmt OCT " ^ Int16.toString x ^ " = ")
           ; callS (Int16.fmt StringCvt.OCT) x
           ; print ("fmt DEC " ^ Int16.toString x ^ " = ")
           ; callS (Int16.fmt StringCvt.DEC) x
           ; print ("fmt HEX " ^ Int16.toString x ^ " = ")
           ; callS (Int16.fmt StringCvt.HEX) x
           ; print ("toLarge " ^ Int16.toString x ^ " = ")
           ; callS (LargeInt.toString o Int16.toLarge) x
           );
List.app un
[~32768
,~32767
,~77
,~3
,~2
,~1
,0
,1
,2
,3
,78
,32766
,32767
,25136
,17047
,~8097
,31503
,~32560
,~2606
,~8303
,~25065
,12939
,26719
,~12812
,~32462
,~1349
,13189
,18830
,16169
,~4360
,29278
,7516
,24155
,~15123
,~6017
,1090
,~30199
,2379
,17051
,~28550
,~11752
,24209
,13536
,~2742
,2210
,738
,18155
,28191
,~88
,~19493
,10786
,~23086
,14013
,~17336
,~15765
,27632
,~8835
,7830
,~7240
,~4233
,9631
,~20491
,24614
];
List.app bin
[(~32768,~32768)
,(~32768,~32767)
,(~32768,~35)
,(~32768,~3)
,(~32768,~2)
,(~32768,~1)
,(~32768,0)
,(~32768,1)
,(~32768,2)
,(~32768,3)
,(~32768,99)
,(~32768,32766)
,(~32768,32767)
,(~32767,~32768)
,(~32767,~32767)
,(~32767,~35)
,(~32767,~3)
,(~32767,~2)
,(~32767,~1)
,(~32767,0)
,(~32767,1)
,(~32767,2)
,(~32767,3)
,(~32767,99)
,(~32767,32766)
,(~32767,32767)
,(~77,~32768)
,(~77,~32767)
,(~77,~35)
,(~77,~3)
,(~77,~2)
,(~77,~1)
,(~77,0)
,(~77,1)
,(~77,2)
,(~77,3)
,(~77,99)
,(~77,32766)
,(~77,32767)
,(~3,~32768)
,(~3,~32767)
,(~3,~35)
,(~3,~3)
,(~3,~2)
,(~3,~1)
,(~3,0)
,(~3,1)
,(~3,2)
,(~3,3)
,(~3,99)
,(~3,32766)
,(~3,32767)
,(~2,~32768)
,(~2,~32767)
,(~2,~35)
,(~2,~3)
,(~2,~2)
,(~2,~1)
,(~2,0)
,(~2,1)
,(~2,2)
,(~2,3)
,(~2,99)
,(~2,32766)
,(~2,32767)
,(~1,~32768)
,(~1,~32767)
,(~1,~35)
,(~1,~3)
,(~1,~2)
,(~1,~1)
,(~1,0)
,(~1,1)
,(~1,2)
,(~1,3)
,(~1,99)
,(~1,32766)
,(~1,32767)
,(0,~32768)
,(0,~32767)
,(0,~35)
,(0,~3)
,(0,~2)
,(0,~1)
,(0,0)
,(0,1)
,(0,2)
,(0,3)
,(0,99)
,(0,32766)
,(0,32767)
,(1,~32768)
,(1,~32767)
,(1,~35)
,(1,~3)
,(1,~2)
,(1,~1)
,(1,0)
,(1,1)
,(1,2)
,(1,3)
,(1,99)
,(1,32766)
,(1,32767)
,(2,~32768)
,(2,~32767)
,(2,~35)
,(2,~3)
,(2,~2)
,(2,~1)
,(2,0)
,(2,1)
,(2,2)
,(2,3)
,(2,99)
,(2,32766)
,(2,32767)
,(3,~32768)
,(3,~32767)
,(3,~35)
,(3,~3)
,(3,~2)
,(3,~1)
,(3,0)
,(3,1)
,(3,2)
,(3,3)
,(3,99)
,(3,32766)
,(3,32767)
,(78,~32768)
,(78,~32767)
,(78,~35)
,(78,~3)
,(78,~2)
,(78,~1)
,(78,0)
,(78,1)
,(78,2)
,(78,3)
,(78,99)
,(78,32766)
,(78,32767)
,(32766,~32768)
,(32766,~32767)
,(32766,~35)
,(32766,~3)
,(32766,~2)
,(32766,~1)
,(32766,0)
,(32766,1)
,(32766,2)
,(32766,3)
,(32766,99)
,(32766,32766)
,(32766,32767)
,(32767,~32768)
,(32767,~32767)
,(32767,~35)
,(32767,~3)
,(32767,~2)
,(32767,~1)
,(32767,0)
,(32767,1)
,(32767,2)
,(32767,3)
,(32767,99)
,(32767,32766)
,(32767,32767)
,(19598,~7421)
,(~21407,~15274)
,(~5808,30898)
,(~13093,19789)
,(~6847,~23605)
,(13990,~4550)
,(~3965,21754)
,(20923,~8569)
,(~8572,~32407)
,(23069,~24084)
,(~9502,~12019)
,(26092,~1378)
,(~28196,12315)
,(~13641,~29511)
,(~13038,~27200)
,(6851,~18488)
,(17708,19740)
,(28258,25385)
,(~3515,2931)
,(~19054,~6222)
,(26045,14120)
,(18771,5081)
,(20397,1519)
,(31880,31826)
,(7631,~32170)
,(7695,~24258)
,(~8754,23940)
,(3629,12394)
,(14384,~26502)
,(10225,30455)
,(21170,~23458)
,(29998,23691)
,(~15487,~21709)
,(~16023,~18113)
,(~9929,~32721)
,(~28585,1440)
,(26753,~20303)
,(~26399,~24660)
,(3931,2165)
,(5088,~11604)
,(~15359,11070)
,(~18518,6708)
,(20227,~20162)
,(16262,25991)
,(28263,27481)
,(~3162,24485)
,(~228,11183)
,(31215,22731)
,(~17288,5059)
,(~20355,4184)
,(~28644,~29237)
,(~24108,~27411)
,(~27313,~2246)
,(~8047,16675)
,(21547,~15151)
,(~14779,21986)
,(~24009,~1795)
,(~8046,~19815)
,(~19694,4562)
,(11542,2521)
,(30712,~32519)
,(~5781,20937)
,(~12048,~29796)
,(22348,27996)
,(6579,32035)
,(~17728,2301)
,(24862,~3319)
,(29322,~23228)
,(32109,11466)
,(22651,32703)
,(~19627,~14823)
,(32207,~9684)
,(5073,22225)
,(~20357,11171)
,(18646,6239)
,(~9535,~15386)
,(28149,9016)
,(~790,20308)
,(2287,1937)
,(2620,6151)
,(~23985,27183)
,(~17370,31387)
,(7427,~14966)
,(~23336,~1418)
,(3043,~386)
,(15358,~15729)
,(3213,8283)
,(28068,~10984)
,(20640,1579)
,(21198,29031)
,(4918,~9505)
,(~3962,~1633)
,(~19405,26368)
,(24333,27498)
,(10070,13643)
,(13182,22766)
,(32141,~2185)
,(~10599,2981)
,(3081,31233)
,(~1190,7913)
,(31960,~20735)
,(~5070,5290)
,(~20685,11343)
,(~4061,~3187)
,(~1198,17903)
,(27002,22718)
,(~29731,~12581)
,(12519,~15799)
,(~26278,~12988)
,(~30239,15371)
,(27222,222)
,(~2425,15605)
,(1538,11681)
,(419,~16718)
,(~22165,~19595)
,(~18787,~20374)
,(~2925,~10709)
,(6840,~15347)
,(~24843,3489)
,(~23071,~31940)
,(1847,~8596)
,(~2088,26764)
,(~24704,~13300)
,(~836,~4336)
,(10402,~16459)
,(~11186,31651)
,(13892,~2172)
,(~23516,~2004)
,(~19950,~22918)
,(~2707,~26626)
,(19945,3618)
,(~13820,~12633)
,(14887,~4308)
,(~7870,12853)
,(~28866,29008)
,(28425,5197)
,(~32378,20076)
,(~26487,21409)
,(26255,7387)
,(5848,21916)
,(~4081,28637)
,(~8881,~2138)
,(1729,31834)
,(~20767,9376)
,(~11862,20990)
,(~11474,4503)
,(~12414,22283)
,(~6661,~29456)
,(25474,~3620)
,(31089,17812)
,(2026,~5783)
,(~18703,~18221)
,(~15428,788)
,(~23371,28759)
,(~9778,28181)
,(~7185,16543)
,(9638,~10857)
,(~20408,~23814)
,(4120,~25042)
,(31744,~20578)
,(~21387,969)
,(~30096,21326)
,(~25530,~24171)
,(2608,~2857)
,(3494,12430)
,(3593,~313)
,(12904,~4974)
,(~16548,~5935)
,(~6048,~10727)
,(~32186,~5439)
,(10542,31484)
,(13112,~24948)
,(~29059,12091)
,(25620,~18680)
,(3989,~4385)
,(~5531,~26390)
,(~16966,~27745)
,(21192,3835)
,(32279,8894)
,(~16509,~23281)
,(~9475,~9246)
,(~25898,25206)
,(20196,17956)
,(27083,~23708)
,(~7439,~15802)
,(~17491,32469)
,(20005,3831)
,(~21865,16994)
,(25963,~6655)
,(~29411,18486)
,(26137,3324)
,(4939,~13250)
,(20330,~19656)
,(30701,~1704)
,(~2341,~2101)
,(1898,~3499)
,(~11027,8275)
,(1001,~30822)
,(~8294,14747)
,(~12664,29143)
,(12444,23325)
,(1237,~5563)
,(26523,~19415)
,(4181,~28659)
,(~28220,~16508)
,(22950,11317)
,(~11450,~25160)
,(~2180,16403)
,(~27954,~28581)
,(10282,16234)
,(~6078,21633)
,(23424,~579)
,(~15932,~6214)
,(8911,~23534)
,(~17156,1145)
,(18022,6902)
,(25851,27875)
,(7773,15104)
,(~21222,~20635)
,(~21730,26169)
,(12518,~9212)
,(30914,~17362)
,(28757,~11584)
,(~16197,32022)
,(~6031,31740)
,(13345,~28613)
,(~10116,~10262)
,(12828,2207)
,(14739,~6257)
,(29078,~25069)
,(~19816,7762)
,(8858,~24246)
,(27531,~25112)
,(29728,~28995)
,(21956,8027)
,(~11090,31445)
,(4614,5067)
,(29148,21463)
,(2922,27700)
,(~24594,~1401)
,(~31630,8800)
,(3041,19671)
,(~18939,16717)
,(5937,~23827)
,(22015,~11126)
,(23312,~6029)
,(22978,~3595)
,(29592,~20157)
,(~13547,12660)
,(21625,~17511)
,(27573,~28844)
,(31320,~894)
,(7637,~24871)
,(3059,16611)
,(24801,31568)
,(~17025,12214)
,(18388,4346)
,(2235,31473)
,(22303,~27441)
,(~1992,638)
,(4670,2517)
,(27620,~27195)
,(15832,24914)
,(550,~24125)
,(17485,~14891)
,(11569,30371)
,(~18897,~11350)
,(26806,~9911)
,(~28671,~15772)
,(~25149,13682)
,(1986,17726)
,(3420,23615)
,(~10001,30063)
,(~25137,11131)
,(~4463,9300)
,(~30979,9024)
,(17610,24816)
,(~8862,~23637)
,(~15825,24173)
,(3364,~20609)
,(8496,~5292)
,(8892,~7360)
,(~30662,~11830)
,(21456,~15217)
,(18707,~31247)
,(15555,~7172)
,(~11155,32598)
,(21877,23279)
,(19595,3412)
,(24191,~22821)
,(~12210,~11257)
,(9568,7200)
,(~13859,~24576)
,(~8282,29914)
,(9085,~27569)
,(~25349,29316)
,(8871,~1504)
,(13462,~11898)
,(~13291,9021)
,(~3206,17592)
,(9631,2440)
,(6979,~32540)
,(8565,21838)
,(14853,12508)
,(6694,~32113)
,(16594,14697)
,(~30746,~1936)
,(19690,26991)
,(~4369,~18119)
,(11901,~27683)
,(31502,~2696)
,(10099,12135)
,(~10095,20229)
,(4275,2853)
,(8587,~28105)
,(27076,~20345)
,(~2713,24602)
,(12690,725)
,(8160,6214)
,(~3422,~31700)
,(~19645,~4648)
,(~13619,701)
,(16265,~14680)
,(~11857,~22460)
,(2267,~17740)
,(28569,25777)
,(~499,~5651)
,(~14529,22906)
,(1833,167)
,(~6725,~18415)
,(~6709,~8593)
,(~14045,15859)
,(16701,~3158)
,(~21156,~9848)
,(~28402,~18766)
,(19570,~11362)
,(25014,32317)
,(~13100,~3639)
,(20298,9180)
,(14333,13356)
,(27995,3167)
,(~17311,11811)
,(~28260,~30596)
,(~25791,10168)
,(~4418,23684)
,(26470,20655)
,(~26328,12270)
,(20127,20554)
,(~9962,~19344)
,(20763,~12736)
,(~32184,~23258)
,(~23899,23584)
,(11752,15294)
,(558,4423)
,(24739,~32363)
,(21649,~4415)
,(31940,5286)
,(32489,25206)
,(31728,~30631)
,(~20205,2225)
,(~25147,~27687)
,(~10947,24661)
,(~14158,~24892)
,(~31328,~20487)
,(18497,27545)
,(~20179,~19629)
,(1631,6661)
,(~28403,~20518)
,(7093,~23686)
,(120,~4557)
,(13755,~11676)
,(~21595,~7024)
,(~24178,~4443)
,(10556,31847)
,(~3263,18409)
,(30748,~30249)
,(20760,~17252)
,(~731,~12338)
,(29653,~23497)
,(29074,~22817)
,(4599,~9397)
,(5181,32431)
,(~6814,~2155)
,(~22800,~23843)
,(~10863,10525)
,(23648,~24183)
,(17398,~30410)
,(26046,16436)
,(1335,19260)
,(24513,~7183)
,(10969,~15309)
,(26685,24151)
,(~31499,~14373)
,(16400,~26896)
,(17840,~4457)
,(2872,24679)
,(23488,~30673)
,(27299,10122)
,(14371,~17473)
,(12730,~8040)
,(5510,7370)
,(30582,~18661)
,(~2593,~1913)
,(~25138,~22973)
,(~1079,485)
,(~15194,~25545)
,(6101,~13364)
,(~3229,~10980)
,(~2342,8076)
,(17723,18859)
,(27469,~2913)
,(~13712,~6612)
,(~31080,14005)
,(4878,~12544)
,(~15400,~13889)
,(14498,26818)
,(~3753,~4134)
,(26139,14087)
,(20585,5908)
,(~6520,14230)
,(5423,~2263)
,(~24689,~8405)
,(25083,~31292)
,(~8115,~19085)
,(~17190,6900)
,(13108,~18957)
,(13713,7320)
,(26855,~23469)
,(2978,8780)
,(23898,11155)
,(13429,~11498)
,(12524,2068)
,(21778,20590)
,(3027,4443)
,(27766,7388)
,(26694,14111)
,(17956,8326)
,(31140,4040)
,(~16420,~17479)
,(~29317,117)
,(~27026,18715)
,(12966,20898)
,(~9795,~1056)
,(4141,20926)
,(~7800,~6020)
,(32402,~31232)
,(~23453,~19820)
,(23431,24426)
,(28284,22393)
,(~26361,~32600)
,(~3422,26490)
,(~3342,~19210)
,(~292,12053)
,(2122,~384)
,(~30979,14272)
,(21105,23076)
,(~17008,~20142)
,(~26331,1694)
,(9745,~20719)
,(23649,~2058)
,(4162,18721)
,(20487,26910)
,(~27802,12095)
,(21397,16226)
,(~21427,26432)
,(32291,16020)
,(29740,~3891)
,(~9484,15077)
,(~30036,~4787)
,(~32491,~3468)
,(28909,19262)
,(8277,~2223)
,(~20808,~17851)
,(~2116,6324)
,(~2209,~17118)
,(4250,~15083)
,(5156,13329)
,(17159,26405)
,(18976,~27411)
,(11232,~9194)
,(32412,~4907)
,(21642,~28605)
,(~30592,~26196)
,(29376,19303)
,(16295,23120)
,(~7911,2194)
,(~10225,~13180)
,(8587,~27798)
,(~3507,31003)
,(~25228,25634)
,(~31601,~7165)
,(~21170,~4940)
,(~24285,~8077)
,(~7576,21061)
,(~32586,~23179)
,(~25028,30832)
,(~30077,23967)
,(21716,~18861)
,(15576,4670)
,(~12963,20598)
,(9750,~27324)
,(27430,~9177)
,(4177,15303)
,(7988,~2065)
,(24385,~1060)
,(9679,~19506)
,(15897,~554)
,(6119,31154)
,(~4914,32148)
,(~24118,3599)
,(19309,~10051)
,(28738,~12825)
,(~25237,~1977)
,(~2086,~27574)
,(10957,32557)
,(~10322,~28871)
,(5457,6029)
,(~7920,29565)
,(29509,27030)
,(17720,~20687)
,(27386,16421)
,(~13997,~15549)
,(23491,~7936)
,(~9593,~2692)
,(14159,~8819)
,(27059,~23977)
,(~15782,~14634)
,(~9154,~22707)
,(15596,~13873)
,(~3156,~29802)
,(~7807,17227)
,(~32520,~18814)
,(4197,~9176)
,(~26396,82)
,(16838,19479)
,(~11439,27239)
,(14501,~16859)
,(~10695,14226)
,(790,16767)
,(32018,~5718)
,(~15427,18454)
,(~9185,18747)
,(~7224,~15688)
,(~12066,32167)
,(28188,31927)
,(27780,20759)
,(~29587,18671)
,(~29073,~27256)
,(1323,32593)
,(14815,~1465)
,(~926,~13660)
,(~28376,~16415)
,(~3532,4963)
,(2187,28971)
,(23678,~28646)
,(9138,16787)
,(17962,20035)
,(31187,13104)
,(11090,10398)
,(~11954,~31696)
,(~17258,~9848)
,(~7657,~26352)
,(~15545,16837)
,(~13666,11190)
,(8982,26341)
,(11552,20708)
,(~2337,9617)
,(~7729,~6269)
,(~4408,~2469)
,(~22758,32256)
,(~28563,~22744)
,(~8705,21692)
,(~3621,27752)
,(~17101,15242)
,(~17657,~21548)
,(~8834,~11126)
,(~11249,~13393)
,(19733,4567)
,(10954,24876)
,(~30210,10663)
,(23791,11227)
,(11346,9285)
,(~991,14284)
,(17926,7352)
,(~29972,10812)
,(16827,~5062)
,(~27990,~5444)
,(31092,25041)
,(21084,~29158)
,(~9860,15850)
,(~20404,~22704)
,(~26110,14410)
,(~10569,8509)
,(~16804,~29365)
,(~17020,6688)
,(22522,~14779)
,(15234,5249)
,(111,17153)
,(~16841,~2040)
,(20157,17118)
,(31638,30272)
,(1939,~29351)
,(~13199,4757)
,(19389,3312)
,(19772,~20257)
,(13965,22584)
,(22486,~3182)
,(22711,~31929)
,(22125,664)
,(~14210,~29751)
,(2809,29786)
,(9390,~27335)
,(21189,8142)
,(22434,28046)
,(3880,~27813)
,(~25234,~31670)
,(~21749,~140)
,(~8067,~11594)
,(30380,15861)
,(~31911,~6222)
,(~17179,4108)
,(9045,~19483)
,(20005,5342)
,(~20240,10598)
,(~813,~13195)
,(~27386,19441)
,(~4780,~13554)
,(2063,21251)
,(~13418,31730)
,(~32633,~6858)
,(21320,~19733)
,(~4189,19969)
,(20687,~4885)
,(3758,~12752)
,(1274,30445)
,(~13493,~21844)
,(~4255,~10122)
,(31119,~30447)
,(~3838,12117)
,(~29444,23372)
,(~26016,~25479)
,(25066,30742)
,(~22809,3733)
,(17729,~3749)
,(32143,~7527)
,(28450,4451)
,(~20877,29040)
,(~11426,11926)
,(8755,14858)
,(~18283,8216)
,(~3868,~12278)
,(~5641,~28361)
,(~2276,21492)
,(6763,~31249)
,(26109,29252)
,(4158,20099)
,(2273,12245)
,(23335,~397)
,(23902,5822)
,(~3295,~31166)
,(~11999,~8844)
,(29297,~28968)
,(~30549,18629)
,(~6798,2408)
,(12159,~28797)
,(25457,~20081)
,(12375,~10480)
,(~21764,12886)
,(6234,19062)
,(25577,21488)
,(~4952,31226)
,(16522,~9239)
,(8874,5049)
,(20645,30070)
,(22428,6328)
,(31562,~20710)
,(~29933,14288)
,(15086,~21222)
,(~3016,7159)
,(~26972,14494)
,(~8256,~32393)
,(20754,~3)
,(26853,~2336)
,(20124,19826)
,(~13405,30181)
,(~14206,~7534)
,(19281,~1980)
,(~32249,~6902)
,(14750,~10478)
,(~22305,10169)
,(3204,2258)
,(5564,~7678)
,(~28186,~29358)
,(15551,18579)
,(~26701,14677)
,(18489,9357)
,(25400,14571)
,(13630,~14648)
,(~13569,26635)
,(11918,~20155)
,(26277,~15445)
,(4433,29303)
,(~22070,29188)
,(23059,~4881)
,(24908,~1004)
,(16105,27907)
,(~9310,31138)
,(11923,~2659)
,(32175,18479)
,(23720,~22047)
,(25078,~3620)
,(23463,~16794)
,(12308,~14611)
,(~20849,14316)
,(~17307,5691)
,(~25783,~23751)
,(~20787,~9663)
,(~22038,~10081)
,(~1899,20496)
,(~28578,~7260)
,(~19822,~3528)
,(~13063,~22861)
,(14690,11079)
,(~2637,~31994)
,(~15381,~29286)
,(20380,9581)
,(~27735,9589)
,(~30449,~2561)
,(7030,6299)
,(~17541,~7999)
,(~12211,27301)
,(3145,23372)
,(7160,11419)
,(~5127,~30199)
,(~14426,~29498)
,(25976,6764)
,(~17754,~24629)
,(26196,21343)
,(~20823,29710)
,(~13639,31299)
,(~2679,~21436)
,(8701,22455)
,(10898,6730)
,(32041,~14042)
,(20079,~19146)
,(23208,3087)
,(29335,4706)
,(~23980,15125)
,(~3891,496)
,(16378,227)
,(~6390,~18580)
,(28498,15249)
,(4965,~3037)
,(~32546,~19266)
,(~21035,20656)
,(~24690,~4502)
,(6991,~22163)
,(2065,~19280)
,(~5802,~14678)
,(~29012,84)
,(4981,9378)
,(5187,~25725)
,(~10005,~21136)
,(3333,~12484)
,(~10540,25914)
,(~7025,~28232)
,(~9308,~15127)
,(2198,26718)
,(~12950,30343)
,(~24130,~8478)
,(11436,27460)
,(~21203,29792)
,(18578,19874)
,(21664,18081)
,(9175,~10656)
,(7821,10601)
,(~27793,~7695)
,(3664,~4109)
,(~25709,20757)
,(~20884,11851)
,(23929,3979)
,(~18788,2886)
,(14917,25812)
,(~22073,~2296)
,(~20936,~17773)
,(21296,~24176)
,(25230,20912)
,(~22095,22604)
,(15208,11151)
,(31800,~32428)
,(~53,~1572)
,(~24875,~9306)
,(~16013,~11088)
,(18606,~4459)
,(~23867,31293)
,(26908,22911)
,(24394,30176)
,(13004,27688)
,(~21949,10924)
,(6894,13294)
,(24623,1416)
,(6060,9482)
,(~459,7226)
,(15775,~29927)
,(26452,14196)
,(18283,30183)
,(15712,~9960)
,(30602,~4382)
,(20615,~3655)
,(25322,27929)
,(~24131,13387)
,(12817,645)
,(7498,~6053)
,(4470,~16247)
,(~30181,~21562)
,(28193,~29154)
,(13690,9033)
,(18405,24969)
,(15757,~22714)
,(25908,~30208)
,(26247,12994)
,(~4554,~13747)
,(10984,6984)
,(~22072,19702)
,(~23559,32542)
,(21779,31020)
,(7806,28032)
,(~1767,~16506)
,(9757,~15770)
,(~3222,4710)
,(~9089,~9767)
,(28571,17898)
,(22743,~13940)
,(12754,~4002)
,(~11838,~9481)
,(24764,~24349)
,(4704,~23045)
,(~3892,~20856)
,(6343,17264)
,(~22268,5275)
,(23385,6795)
,(15142,~29555)
,(~28879,15681)
,(~5979,~29312)
,(21858,~6279)
,(21300,1184)
,(~3537,~13216)
,(~22343,~10447)
,(22084,21790)
,(11519,22911)
,(20697,~13459)
,(~7718,5053)
,(~14292,~12334)
,(~11675,~17659)
,(~5092,24454)
,(~24497,26948)
,(21734,~1556)
,(~17402,~22702)
,(~8355,16920)
,(~11190,14756)
,(21059,~16728)
,(15753,~9592)
,(19540,~1308)
,(18310,~444)
,(~11542,9828)
,(~15728,~12173)
,(~14287,~18403)
,(~8641,~24166)
,(~9596,8841)
,(24622,~11962)
,(~32594,~1271)
,(~31843,31859)
,(3507,8408)
,(8832,29165)
,(1566,~15687)
,(15469,~17511)
,(24359,567)
,(22615,~20185)
,(~12655,~12648)
,(~23851,16252)
,(15868,~16142)
,(7076,~3924)
,(~16627,11097)
,(~12204,18522)
,(~10922,~13992)
,(20348,7211)
,(25500,~21590)
,(~5659,~19659)
,(28827,450)
,(15744,15317)
,(~18329,~6108)
,(~12676,~12251)
,(~12450,25498)
,(~6262,8333)
,(~15313,~16088)
,(~32035,20989)
,(25664,13168)
,(~8277,18521)
,(2531,21427)
,(~28954,5604)
,(~18070,~4805)
,(12622,~4176)
,(~19352,5568)
,(~14090,~26107)
,(~32330,12663)
,(~21956,27500)
,(20681,~1492)
,(~5329,~23949)
,(24456,~32163)
,(15508,~9109)
,(27555,18825)
,(1949,~24209)
,(~32564,32575)
,(13544,~2410)
,(254,11316)
,(30952,24442)
,(16999,8620)
,(~19390,21700)
,(~8538,11795)
,(~25754,8013)
,(4803,27488)
,(~27502,25552)
,(8589,18095)
,(7570,~17667)
,(~11846,~1348)
,(31367,~28966)
,(~14804,~30967)
,(5323,21797)
,(~4226,15589)
,(~18008,~13224)
,(~32357,~2000)
,(22877,~13812)
,(~22994,23555)
,(~15705,23525)
,(7514,~32058)
,(3906,2609)
,(9740,30692)
,(~32549,~3025)
,(~30533,19642)
,(~24450,~9355)
,(25825,6798)
,(13040,~918)
,(16902,18980)
,(26479,30808)
,(~7996,~32081)
,(~27324,~7310)
,(9307,18269)
,(~22262,32728)
,(13478,25772)
,(4764,~30572)
,(1388,7410)
,(~26291,~27479)
,(~21245,29886)
,(13804,664)
,(4360,~29577)
,(26552,5007)
,(29649,~24709)
,(~21904,~7645)
,(16474,24899)
,(~28549,~23975)
,(20330,31722)
,(12,11065)
,(~13039,3896)
,(~23402,~30193)
,(~10477,24475)
,(16545,405)
,(~7801,23496)
,(16570,~24239)
,(28336,17584)
,(1973,7783)
,(~29933,19477)
,(30191,21842)
,(17575,673)
,(~19707,27494)
,(~277,32519)
,(~20932,~26811)
,(610,~11978)
,(25402,9339)
,(~29994,~9026)
,(~7183,~22276)
,(~18454,4169)
,(~18138,~14973)
,(16744,~13638)
,(~27586,~23752)
,(~11750,11303)
,(5607,~3167)
,(~32652,26983)
,(~8366,18124)
,(30224,~13822)
,(9747,21819)
,(~22168,~3995)
,(~5803,15704)
,(~30117,5876)
,(~27375,~32417)
,(~15969,1676)
,(23285,~29276)
,(15190,~16477)
,(~9948,27957)
,(21070,2115)
,(11310,25531)
];
List.app (fn x => (print ("fromLarge " ^ LargeInt.toString x ^ " = "); call Int16.fromLarge x))
[~32768
,~32767
,~77
,~3
,~2
,~1
,0
,1
,2
,3
,78
,32766
,32767
,25136
,17047
,~8097
,31503
,~32560
,~2606
,~8303
,~25065
,12939
,26719
,~12812
,~32462
,~1349
,13189
,18830
,16169
,~4360
,29278
,7516
,24155
,~15123
,~6017
,1090
,~30199
,2379
,17051
,~28550
,~11752
,24209
,13536
,~2742
,2210
,738
,18155
,28191
,~88
,~19493
,10786
,~23086
,14013
,~17336
,~15765
,27632
,~8835
,7830
,~7240
,~4233
,9631
,~20491
,24614
,~3091305
,~14535415
,~13162288
,~9195814
,~1198754
,13614603
,~13041722
,10569465
,1242401
,16205406
,15638048
,4622596
,~8953948
,~10230417
,~2578649
,~5853952
,~1718443
,422050
,5931512
,~971726
,~14404380
,~9271690
,14553056
,~2795205
,~9447547
,~8810920
,~10224525
,8455819
,~14419884
,1006040
,~11083201
,14715382
,1404517
,~11900880
,~15457881
,~13632831
,~11167998
,9308171
,13175918
,~3470197
,~16201471
,13196350
,~8618763
,2242877
,11694156
,~7909064
,~1231856
,~2078302
,3532609
,~13011517
,14276757
,6969887
,8699504
,~9761682
,10104694
,~2390417
,~13107448
,8253711
,~16106806
,7224643
,~1940867
,15984494
,~5037412
,3674772
,~8051670
,12307059
,10728284
,~5510312
,8071758
,~15292895
,~4282318
,6868574
,12628052
,7317872
,8112244
,~16139620
,~553133
,949319
,~5831496
,~1712816
,~14489607
,~15486976
,~8106975
,5549457
,~10767739
,~7124683
,3398142
,~1369289
,2995498
,~1444059
,704483
,1973291
,~14333027
,11711806
,~8164509
,15925346
,16451540
,9246006
,~2483272
,3049905
];
List.app (fn s => (print ("fromString " ^ s ^ " = "); callO Int16.fromString s))
["-32768"
,"-32767"
,"-77"
,"-3"
,"-2"
,"-1"
,"0"
,"1"
,"2"
,"3"
,"78"
,"32766"
,"32767"
,"25136"
,"17047"
,"-8097"
,"31503"
,"-32560"
,"-2606"
,"-8303"
,"-25065"
,"12939"
,"26719"
,"-12812"
,"-32462"
,"-1349"
,"13189"
,"18830"
,"16169"
,"-4360"
,"29278"
,"7516"
,"24155"
,"-15123"
,"-6017"
,"1090"
,"-30199"
,"2379"
,"17051"
,"-28550"
,"-11752"
,"24209"
,"13536"
,"-2742"
,"2210"
,"738"
,"18155"
,"28191"
,"-88"
,"-19493"
,"10786"
,"-23086"
,"14013"
,"-17336"
,"-15765"
,"27632"
,"-8835"
,"7830"
,"-7240"
,"-4233"
,"9631"
,"-20491"
,"24614"
,"-3091305"
,"-14535415"
,"-13162288"
,"-9195814"
,"-1198754"
,"13614603"
,"-13041722"
,"10569465"
,"1242401"
,"16205406"
,"15638048"
,"4622596"
,"-8953948"
,"-10230417"
,"-2578649"
,"-5853952"
,"-1718443"
,"422050"
,"5931512"
,"-971726"
,"-14404380"
,"-9271690"
,"14553056"
,"-2795205"
,"-9447547"
,"-8810920"
,"-10224525"
,"8455819"
,"-14419884"
,"1006040"
,"-11083201"
,"14715382"
,"1404517"
,"-11900880"
,"-15457881"
,"-13632831"
,"-11167998"
,"9308171"
,"13175918"
,"-3470197"
,"-16201471"
,"13196350"
,"-8618763"
,"2242877"
,"11694156"
,"-7909064"
,"-1231856"
,"-2078302"
,"3532609"
,"-13011517"
,"14276757"
,"6969887"
,"8699504"
,"-9761682"
,"10104694"
,"-2390417"
,"-13107448"
,"8253711"
,"-16106806"
,"7224643"
,"-1940867"
,"15984494"
,"-5037412"
,"3674772"
,"-8051670"
,"12307059"
,"10728284"
,"-5510312"
,"8071758"
,"-15292895"
,"-4282318"
,"6868574"
,"12628052"
,"7317872"
,"8112244"
,"-16139620"
,"-553133"
,"949319"
,"-5831496"
,"-1712816"
,"-14489607"
,"-15486976"
,"-8106975"
,"5549457"
,"-10767739"
,"-7124683"
,"3398142"
,"-1369289"
,"2995498"
,"-1444059"
,"704483"
,"1973291"
,"-14333027"
,"11711806"
,"-8164509"
,"15925346"
,"16451540"
,"9246006"
,"-2483272"
,"3049905"
];
List.app (fn s => (print ("scan BIN " ^ s ^ " = "); callO (StringCvt.scanString (Int16.scan StringCvt.BIN)) s))
["-1000000000000000"
,"-111111111111111"
,"-1001101"
,"-11"
,"-10"
,"-1"
,"0"
,"1"
,"10"
,"11"
,"1001110"
,"111111111111110"
,"111111111111111"
,"110001000110000"
,"100001010010111"
,"-1111110100001"
,"111101100001111"
,"-111111100110000"
,"-101000101110"
,"-10000001101111"
,"-110000111101001"
,"11001010001011"
,"110100001011111"
,"-11001000001100"
,"-111111011001110"
,"-10101000101"
,"11001110000101"
,"100100110001110"
,"11111100101001"
,"-1000100001000"
,"111001001011110"
,"1110101011100"
,"101111001011011"
,"-11101100010011"
,"-1011110000001"
,"10001000010"
,"-111010111110111"
,"100101001011"
,"100001010011011"
,"-110111110000110"
,"-10110111101000"
,"101111010010001"
,"11010011100000"
,"-101010110110"
,"100010100010"
,"1011100010"
,"100011011101011"
,"110111000011111"
,"-1011000"
,"-100110000100101"
,"10101000100010"
,"-101101000101110"
,"11011010111101"
,"-100001110111000"
,"-11110110010101"
,"110101111110000"
,"-10001010000011"
,"1111010010110"
,"-1110001001000"
,"-1000010001001"
,"10010110011111"
,"-101000000001011"
,"110000000100110"
,"-1011110010101101101001"
,"-110111011100101011110111"
,"-110010001101011100110000"
,"-100011000101000100100110"
,"-100100100101010100010"
,"110011111011111000001011"
,"-110001110000000000111010"
,"101000010100011011111001"
,"100101111010100100001"
,"111101110100011001011110"
,"111011101001111000100000"
,"10001101000100100000100"
,"-100010001010000001011100"
,"-100111000001101010010001"
,"-1001110101100011011001"
,"-10110010101001100000000"
,"-110100011100010101011"
,"1100111000010100010"
,"10110101000000111111000"
,"-11101101001111001110"
,"-110110111100101100011100"
,"-100011010111100110001010"
,"110111100000111111100000"
,"-1010101010011011000101"
,"-100100000010100001111011"
,"-100001100111000110101000"
,"-100111000000001110001101"
,"100000010000011010001011"
,"-110111000000011110101100"
,"11110101100111011000"
,"-101010010001110111000001"
,"111000001000100111110110"
,"101010110111001100101"
,"-101101011001011111010000"
,"-111010111101111001011001"
,"-110100000000010100111111"
,"-101010100110100011111110"
,"100011100000100000001011"
,"110010010000110001101110"
,"-1101001111001101110101"
,"-111101110011011011111111"
,"110010010101110000111110"
,"-100000111000001100001011"
,"1000100011100100111101"
,"101100100111000001001100"
,"-11110001010111011001000"
,"-100101100101111110000"
,"-111111011011001011110"
,"1101011110011101000001"
,"-110001101000101000111101"
,"110110011101100010010101"
,"11010100101101000011111"
,"100001001011111001110000"
,"-100101001111001110010010"
,"100110100010111101110110"
,"-1001000111100110010001"
,"-110010000000000011111000"
,"11111011111000100001111"
,"-111101011100010100110110"
,"11011100011110101000011"
,"-111011001110110000011"
,"111100111110011101101110"
,"-10011001101110101100100"
,"1110000001001010010100"
,"-11110101101101111010110"
,"101110111100101001110011"
,"101000111011001101011100"
,"-10101000001010010101000"
,"11110110010101001001110"
,"-111010010101100111011111"
,"-10000010101011111001110"
,"11010001100111001011110"
,"110000001011000001010100"
,"11011111010100101110000"
,"11110111100100001110100"
,"-111101100100010101100100"
,"-10000111000010101101"
,"11100111110001000111"
,"-10110001111101101001000"
,"-110100010001010110000"
,"-110111010001100000000111"
,"-111011000101000000000000"
,"-11110111011001111011111"
,"10101001010110110010001"
,"-101001000100110101111011"
,"-11011001011011011001011"
,"1100111101100111111110"
,"-101001110010011001001"
,"1011011011010100101010"
,"-101100000100011011011"
,"10101011111111100011"
,"111100001110000101011"
,"-110110101011010001100011"
,"101100101011010100111110"
,"-11111001001010010011101"
,"111100110000000001100010"
,"111110110000011111010100"
,"100011010001010100110110"
,"-1001011110010001001000"
,"1011101000100110110001"
];
List.app (fn s => (print ("scan OCT " ^ s ^ " = "); callO (StringCvt.scanString (Int16.scan StringCvt.OCT)) s))
["-100000"
,"-77777"
,"-115"
,"-3"
,"-2"
,"-1"
,"0"
,"1"
,"2"
,"3"
,"116"
,"77776"
,"77777"
,"61060"
,"41227"
,"-17641"
,"75417"
,"-77460"
,"-5056"
,"-20157"
,"-60751"
,"31213"
,"64137"
,"-31014"
,"-77316"
,"-2505"
,"31605"
,"44616"
,"37451"
,"-10410"
,"71136"
,"16534"
,"57133"
,"-35423"
,"-13601"
,"2102"
,"-72767"
,"4513"
,"41233"
,"-67606"
,"-26750"
,"57221"
,"32340"
,"-5266"
,"4242"
,"1342"
,"43353"
,"67037"
,"-130"
,"-46045"
,"25042"
,"-55056"
,"33275"
,"-41670"
,"-36625"
,"65760"
,"-21203"
,"17226"
,"-16110"
,"-10211"
,"22637"
,"-50013"
,"60046"
,"-13625551"
,"-67345367"
,"-62153460"
,"-43050446"
,"-4445242"
,"63737013"
,"-61600072"
,"50243371"
,"4572441"
,"75643136"
,"73517040"
,"21504404"
,"-42120134"
,"-47015221"
,"-11654331"
,"-26251400"
,"-6434253"
,"1470242"
,"26500770"
,"-3551716"
,"-66745434"
,"-43274612"
,"67407740"
,"-12523305"
,"-44024173"
,"-41470650"
,"-47001615"
,"40203213"
,"-67003654"
,"3654730"
,"-52216701"
,"70104766"
,"5267145"
,"-55313720"
,"-72757131"
,"-64002477"
,"-52464376"
,"43404013"
,"62206156"
,"-15171565"
,"-75633377"
,"62256076"
,"-40701413"
,"10434475"
,"54470114"
,"-36127310"
,"-4545760"
,"-7733136"
,"15363501"
,"-61505075"
,"66354225"
,"32455037"
,"41137160"
,"-45171622"
,"46427566"
,"-11074621"
,"-62000370"
,"37370417"
,"-75342466"
,"33436503"
,"-7316603"
,"74763556"
,"-23156544"
,"16011224"
,"-36555726"
,"56745163"
,"50731534"
,"-25012250"
,"36625116"
,"-72254737"
,"-20253716"
,"32147136"
,"60130124"
,"33724560"
,"36744164"
,"-75442544"
,"-2070255"
,"3476107"
,"-26175510"
,"-6421260"
,"-67214007"
,"-73050000"
,"-36731737"
,"25126621"
,"-51046573"
,"-33133313"
,"14754776"
,"-5162311"
,"13332452"
,"-5404333"
,"2537743"
,"7416053"
,"-66532143"
,"54532476"
,"-37112235"
,"74600142"
,"76603724"
,"43212466"
,"-11362110"
,"13504661"
];
List.app (fn s => (print ("scan HEX " ^ s ^ " = "); callO (StringCvt.scanString (Int16.scan StringCvt.HEX)) s))
["-8000"
,"-7fff"
,"-4d"
,"-3"
,"-2"
,"-1"
,"0"
,"1"
,"2"
,"3"
,"4e"
,"7ffe"
,"7fff"
,"6230"
,"4297"
,"-1fa1"
,"7b0f"
,"-7f30"
,"-a2e"
,"-206f"
,"-61e9"
,"328b"
,"685f"
,"-320c"
,"-7ece"
,"-545"
,"3385"
,"498e"
,"3f29"
,"-1108"
,"725e"
,"1d5c"
,"5e5b"
,"-3b13"
,"-1781"
,"442"
,"-75f7"
,"94b"
,"429b"
,"-6f86"
,"-2de8"
,"5e91"
,"34e0"
,"-ab6"
,"8a2"
,"2e2"
,"46eb"
,"6e1f"
,"-58"
,"-4c25"
,"2a22"
,"-5a2e"
,"36bd"
,"-43b8"
,"-3d95"
,"6bf0"
,"-2283"
,"1e96"
,"-1c48"
,"-1089"
,"259f"
,"-500b"
,"6026"
,"-2f2b69"
,"-ddcaf7"
,"-c8d730"
,"-8c5126"
,"-124aa2"
,"cfbe0b"
,"-c7003a"
,"a146f9"
,"12f521"
,"f7465e"
,"ee9e20"
,"468904"
,"-88a05c"
,"-9c1a91"
,"-2758d9"
,"-595300"
,"-1a38ab"
,"670a2"
,"5a81f8"
,"-ed3ce"
,"-dbcb1c"
,"-8d798a"
,"de0fe0"
,"-2aa6c5"
,"-90287b"
,"-8671a8"
,"-9c038d"
,"81068b"
,"-dc07ac"
,"f59d8"
,"-a91dc1"
,"e089f6"
,"156e65"
,"-b597d0"
,"-ebde59"
,"-d0053f"
,"-aa68fe"
,"8e080b"
,"c90c6e"
,"-34f375"
,"-f736ff"
,"c95c3e"
,"-83830b"
,"22393d"
,"b2704c"
,"-78aec8"
,"-12cbf0"
,"-1fb65e"
,"35e741"
,"-c68a3d"
,"d9d895"
,"6a5a1f"
,"84be70"
,"-94f392"
,"9a2f76"
,"-247991"
,"-c800f8"
,"7df10f"
,"-f5c536"
,"6e3d43"
,"-1d9d83"
,"f3e76e"
,"-4cdd64"
,"381294"
,"-7adbd6"
,"bbca73"
,"a3b35c"
,"-5414a8"
,"7b2a4e"
,"-e959df"
,"-4157ce"
,"68ce5e"
,"c0b054"
,"6fa970"
,"7bc874"
,"-f64564"
,"-870ad"
,"e7c47"
,"-58fb48"
,"-1a22b0"
,"-dd1807"
,"-ec5000"
,"-7bb3df"
,"54ad91"
,"-a44d7b"
,"-6cb6cb"
,"33d9fe"
,"-14e4c9"
,"2db52a"
,"-1608db"
,"abfe3"
,"1e1c2b"
,"-dab463"
,"b2b53e"
,"-7c949d"
,"f30062"
,"fb07d4"
,"8d1536"
,"-25e448"
,"2e89b1"
];
